<script src="/vendor/jquery/layer/layer.js"></script>
<div class="row">
    <div class="col-xs-12">


        <form method="GET" action="{{url('admin/wiki/index')}}" class="form-horizontal" accept-charset="UTF-8" pjax-container="1">

            <div class="box-body fields-group">
                <div class="form-group">
                    <label for="logo" class="col-sm-2 control-label">品牌：</label>
                    <div class="col-sm-2">
                        <input type="text"  name="brandName" value="{{$brandName}}" class="form-control text" placeholder="" />
                    </div>
                    <label for="logo" class="col-sm-2 control-label">wiki名称：</label>
                    <div class="col-sm-2">
                        <input type="text"  name="wikiName" value="{{$wikiName}}" class="form-control text" placeholder="" />
                    </div>
                    <div class="col-sm-2">
                        <input class="btn btn-primary" type="submit" value="提交" />
                    </div>
                </div>

            </div>

        </form>



        <div class="box">
            <div class="box-body">
                <form action="{{url('admin/wiki/merge')}}" method="get">
                    <input type="hidden"  name="brandName" value="{{$brandName}}" class="form-control text" placeholder="" />
                    <input type="hidden"  name="wikiName" value="{{$wikiName}}" class="form-control text" placeholder="" />
                    <table id="brandList" class="table table-bordered table-hover">
                        <thead>
                        <tr>
                            <td>
                                <input class="btn btn-primary" type="submit" value="合并多个"/>
                            </td>
                            <td>
                                 共 {{$count}} 个wiki
                            </td>
                            <td>
                            </td>
                            <td>
                            </td>
                            <td>
                            </td>
                            <td>
                            </td>
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <th>id</th>
                            <th>名称</th>
                            <th>图片</th>
                            <th>价格</th>
                            <th>品牌</th>
                            <th>wiki买过数</th>
                            <th>wiki收藏数</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach($list as $item)
{{--                            @if($item['goods_h5_urls'])--}}
                                <tr>
                                    <td> {{$item['id']}} <input type="checkbox" value="{{$item['id']}}"  name="wiki_ids[]" />  </td>
                                    <td>
                                        {{$item['name']}} <br>
                                        @if($item['goods_h5_urls']) spu_id :  @endif
                                        @foreach($item['goods_h5_urls'] as $url)
                                            <a data-href="{{$url['url']}}" href="javascript:void(0)" class="detail">{{$url['goods_id']}}</a>&nbsp;&nbsp;&nbsp;
                                        @endforeach
                                    </td>
                                    <td> <img style="height: 100px; width: 100px;" src="{{$item['thumb_cover_img']}} " class="img-thumbnail"> </td>
                                    <td> {{$item['price']}} </td>
                                    <td> @if($item['brand']) {{$item['brand']['name'] or ''}} @endif</td>
                                    <td> {{$item['counter']['bought_num']}}</td>
                                    <td> {{$item['counter']['fav_num']}}</td>
                                    <td>
                                        <a class="btn btn-primary start-scraper" href="{{url('admin/wiki/editWiki')}}?wiki_id={{$item['id']}}"> 编辑 </a>
                                        <a class="btn btn-primary start-scraper" href="{{url('admin/wiki/merge')}}?wiki_ids={{$item['id']}}"> 合并 </a>
                                    </td>
                                </tr>
                            {{--@endif--}}
                        @endforeach
                        </tbody>
                    </table>
                </form>
            </div>
            <div class="box-footer clearfix">
                {{$page}}
            </div>
        </div>
    </div>
</div>
<script>
    $(function(){
        $('.detail').click(function(){
            var url = $(this).attr('data-href');

            layer.open({
                type: 2,
                title: '预览',
                shadeClose: true,
                shade: 0.8,
                area: ['380px', '90%'],
                content: url
            });
        });

    })

</script>